bool fun(int a,int b){
    return a > b;
}
class Solution {
public:
    int minSetSize(vector<int>& arr) {
        int nums[100005] = {0};
        for(auto e : arr){
            nums[e]++;
        }
        sort(&nums[0],&nums[100004],fun);
        int ans = 0,sum = 0, n = arr.size();
        while(sum * 2 < n){
            sum += nums[ans];
            ans++;
        }
        return ans;
    }
};